<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>日月交替</title>
    <link rel="stylesheet" href="css/日月交替.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.css"/>
</head>

<body>
    <div class="btn-box">
        <div onclick="change('light')">
            <i class="fa fa-sun-o" aria-hidden="true"></i>你叉叉
        </div>
        <div onclick="change('dark')">
            <i class="fa fa-moon-o" aria-hidden="true"></i>穷哈哈
        </div>
    </div>

     <div class="dark" id="container">
        <div class="bg"></div>
        <div class="moon-box">
            <div class="moon"></div>
        </div>
        <div class="sun-box">
            <div class="sun"></div>
        </div>
        <div class="sea"></div>
     </div>

     <script>
        function change(str) {
            document.getElementById('container').setAttribute('class', str)
        }
     </script>
</body>

</html>